package com.zj.study.sync;

import java.time.LocalDateTime;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class RefundQueryResult {

  /**
   * 是否请求成功
   */
  private boolean success;

  /**
   * 失败原因
   */
  private String errMsg;

  /**
   * 是否网络异常
   */
  private boolean networkError;

  /**
   * 退款订单号
   */
  private String refundNo;

  /**
   * 招行退款订单号
   */
  private String refundTradeNo;

  /**
   * 退款金额
   */
  private Long refundAmount;

  /**
   * 交易状态
   */
  private RefundTradeStateEnum tradeStateEnum;

  /**
   * 订单发送时间
   */
  private LocalDateTime orderTime;

  /**
   * 订单完成日期
   */
  private LocalDateTime finishTime;

  public static RefundQueryResult fail(String msg) {
    return new RefundQueryResult().setSuccess(false).setErrMsg(msg);
  }

  public static RefundQueryResult fail(String msg, boolean networkError) {
    return new RefundQueryResult().setSuccess(false).setErrMsg(msg).setNetworkError(networkError);
  }

  public static RefundQueryResult success(String refundNo) {
    return new RefundQueryResult().setRefundNo(refundNo).setSuccess(true);
  }

}
